﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OrderApp {
  public class Goods {
    public string Id { get; set; }
    public string Name { get; set; }
    public double Price { get; set; }

    public Goods() {
      Id = Guid.NewGuid().ToString();
    }

    public Goods(string name, double price):this() {
      Name = name;
      Price = price;
    }

    public override bool Equals(object obj) {
       var item = obj as Goods;
       return item != null &&
              Id == goods.Id &&
              Name == goods.Name;
            
    }

    public override int GetHashCode() {
            int hashCode;
            Int32.TryParse(Id, out hashCode);
            return hashCode;
        }
  }


}
